import { FastClick } from 'fastclick'

// 添加Fastclick移除移动端点击延迟，ios点击穿透解决方案
FastClick.prototype.focus = function (targetElement: any) {
  let length
  if (
    /iphone|ipod|ipad/i.test(navigator.appVersion) &&
    targetElement.setSelectionRange &&
    targetElement.type.indexOf('date') !== 0 &&
    targetElement.type !== 'time' &&
    targetElement.type !== 'month'
  ) {
    length = targetElement.value.length
    targetElement.focus()
    targetElement.setSelectionRange(length, length)
  } else {
    targetElement.focus()
  }
}
FastClick.attach(document.body)
